var soap = require("strong-soap").soap;

var ip = '127.0.0.1';
var port = 8901;

var WSDL_URL = "http://" + ip + ":" + port + "/?wsdl";

soap.createClient(WSDL_URL, {}, function (err, client) {
    client.setEndpoint(WSDL_URL)
//    console.log(client)
//    console.log("===============================================")
//    console.log(client.describe())
//    console.log("===============================================")

    // 调用say_hello方法 (亲测可行)
    client.say_hello({"name": "ccc", "times": 2}, function (err, result) {
        console.log("<say_hello>Err: ")
        console.log(err)
        console.log("<say_hello>Result: ")
        console.log(result)
        console.log("===============================================")
    })

    // say_hello_1 参数结构
    let arg_1 =  {
        "persons": {
            "Person": [{"name": "zzz", "age": 23}, {"name": "aaa", "age": 18}
            ]
        }
    }
    // 调用say_hello_1方法 (传参可行)
    client.say_hello_1(arg_1, function (err, result) {
        console.log("<say_hello_1>Err: ")
        console.log(err)
        console.log("<say_hello_1>Result: ")
        console.log(result)
        console.log("===============================================")
    })

    // say_hello_2 参数结构
    let arg_2 = {
        persons: {
            string: ["aaa", "zzz"]
        }
    }
    // 调用say_hello_2方法 (传参可行)
    client.say_hello_2(arg_2, function (err, result) {
        console.log("<say_hello_2>Err: ")
        console.log(err)
        console.log("<say_hello_2>Result: ")
        console.log(result)
        console.log("===============================================")
    })

    // say_hello_3 参数结构
    let arg_3 = {
        person: {
            name: "aaa",
            age: 24
        }
    }
    // 调用say_hello_3方法 (传参可行)
    client.say_hello_3(arg_3, function (err, result) {
        console.log("<say_hello_3>Err: ")
        console.log(err)
        console.log("<say_hello_3>Result: ")
        console.log(result)
        console.log("===============================================")
    })
})

